Skip to content

refactor(config): rename parse-config to lint and reject unknown keys#563

Merged
joshua-temple merged 1 commit into
mainfrom
refactor/parse-config-to-lint
Jul 11, 2026
Merged

refactor(config): rename parse-config to lint and reject unknown keys#563
joshua-temple merged 1 commit into
mainfrom
refactor/parse-config-to-lint

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

parse-config both validates a manifest and prints it as JSON, but the top level of the manifest was parsed leniently: an unknown or misspelled key (say enviroments:, or a component-scoped field pasted at the top level) was silently dropped instead of flagged. Components were already strict one level down; the top level was not.

Fix

  • Rename the command to cascade lint. There are no external consumers pinned to parse-config, so this is a straight swap rather than an add. lint prints a human-readable report and exits non-zero when the manifest is invalid; --json preserves the valid/errors/warnings surface the generated lanes gate on.
  • Make top-level parsing strict by mirroring the proven per-component pattern: an inline Extra catch-all on TrunkConfig captures unmodeled keys, and a validation walk rejects each one via the existing error tier with a "did you mean X?" suggestion (Levenshtein against the reflected known-field set). Legitimately open maps (inputs, env_inputs, action_pins) stay open.
  • Migrate every emitter and reference to lint: the four generated lanes (validate_check, merge_queue, pr_preview, hotfix check-job), the two e2e scenarios, cascade's own build-cli smoke test, the byte-identical golden baseline, the schema-description copies, and the CLI and manifest docs. Stale project: test fixtures and the typed-remarshal note are updated for the new strictness.

Verification

  • go build, go test, go test -race, and golangci-lint run clean on the root and e2e modules.
  • New regression tests in internal/config fail before the change and pass after: a misspelled top-level key and a component-scoped field at the top level now produce an unknown-field error (with a suggestion for the misspelling); a known-field manifest stays valid.
  • New e2e scenario 58-lint-strict-rejection proves the merge-queue lane reds when a candidate carries an unknown top-level key.
  • cascade's own manifest and in-repo fixtures lint clean under the new strictness.

Swap the parse-config command to cascade lint (no external consumers to
protect) and make top-level manifest parsing strict: an unknown or
misspelled config key is now a hard error carrying a did-you-mean
suggestion, rather than being silently dropped by the lenient decoder.

Strictness mirrors the proven per-component catch-all one level up: an
inline Extra map on TrunkConfig captures unmodeled keys, which a
validation walk rejects against the reflected known-field set with a
Levenshtein-nearest suggestion. Legitimately open maps stay open.

The four generated lanes (validate_check, merge_queue, pr_preview, hotfix
check-job), the two e2e scenarios, cascade's own build-cli smoke test, the
byte-identical golden baseline, the schema description copies, and the CLI
and manifest docs all move to lint. lint keeps the JSON validity surface
the lanes gate on behind --json. Stale project: fixtures and the
typed-remarshal note are updated for the new strictness.

Verification: go build/test/-race and golangci-lint clean on the root and
e2e modules; new regression tests fail before and pass after.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit a0021be into main Jul 11, 2026
20 checks passed
@joshua-temple joshua-temple deleted the refactor/parse-config-to-lint branch July 11, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant